import React from 'react';
import { router } from "dva";
import EnvConfig from './envConfig';
import { Common } from 'UtilsCommon';

const { Link } = router;

const wetRootPath = EnvConfig.getServiceUrl('WebRootPath')();
const getPath = (url) => {
    if (url.indexOf('#{') > 0) {
        url = Common.replaceDataContent(Common.getQueryString(), url, true);
    }
    return wetRootPath + url;
};
export default ({ to, children, className, style, name, id, title, }) => <Link to={getPath(to)} id={id} name={name} title={title} style={style} className={className}>{children}</Link>;